package com.liu.thredState_study;

public class TeacherThread extends Thread {

    private RunThread runThread;

    public void setThread(RunThread runThread) {
        this.runThread = runThread;
    }

    @Override
    public void run() {
        while (true) {
            synchronized (runThread) {
                if (!runThread.getRun()){
                        System.out.println("老师叫学生去跑");
                    runThread.setRun(true);
                        runThread.notify();
                }
            }
        }
    }
}
